package com.jennifer.andy.androidxlazyload.util

import android.app.Activity
import androidx.lifecycle.MutableLiveData

/**
 * @see KeyBoardUtils.registerSoftInputChangedListener 一个页面只能绑定一次
 */
object ChatKeyboardUtil {

    val onSoftInputChange = MutableLiveData<Int>()

    fun registerSoftInputActivity(
        activity: Activity
    ) {
        removeSoftInputActivity(activity)
        KeyBoardUtils.registerSoftInputChangedListener(activity) {
            onSoftInputChange.value = it
        }
    }

    fun removeSoftInputActivity(activity: Activity) {
        KeyBoardUtils.unregisterSoftInputChangedListener(activity)
    }


}

